package cc.cc4414.cc02.system.form;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

import cc.cc4414.cc02.core.constant.RegexpConsts;
import lombok.Data;

/**
 * @author cc 2018年6月29日
 */
@Data
public class UserForm {

	public interface Add {
	}

	public interface Update {
	}

	public interface Reg {
	}

	@NotNull(groups = { Update.class })
	@Null(groups = { Add.class, Reg.class })
	private Long id;

	/** 用户名 */
	@Null(groups = { Update.class })
	@NotNull(groups = { Add.class, Reg.class })
	@Pattern(regexp = RegexpConsts.USERNAME, groups = { Add.class, Reg.class })
	private String username;

	/** 密码 */
	@Null(groups = { Update.class })
	@NotNull(groups = { Reg.class })
	@Pattern(regexp = RegexpConsts.PASSWORD, groups = { Reg.class })
	private String password;

	/** 昵称 */
	@NotNull(groups = { Add.class, Reg.class, Update.class })
	@Pattern(regexp = RegexpConsts.NICKNAME, groups = { Add.class, Reg.class, Update.class })
	private String nickname;

	/** 手机号 */
	@Pattern(regexp = RegexpConsts.MOBILE, groups = { Add.class, Reg.class, Update.class })
	private String mobile;

	/** 邮箱 */
	@Email(groups = { Add.class, Reg.class, Update.class })
	private String email;
}
